package Revise;

import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;

public class CopyOf {
    public static void main(String[] args) {
        int [] a1=new int[]{5,9,1,1,5};
        int [] a2= Arrays.copyOf(a1,3);
        System.out.println(Arrays.toString(a2));
        int [] a3= Arrays.copyOfRange(a1,0,1);
        System.out.println(Arrays.toString(a3));
        Arrays.sort(a1);
        System.out.println(Arrays.toString(a1));


        Comparator<Integer> c=new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2-o1;
            }
        };
        PriorityQueue<Integer> q=new PriorityQueue<>(c);
        q.offer(2);
        q.offer(7);
        q.offer(6);
        while(!q.isEmpty()){
            System.out.println(q.poll());
        }

    }
}
